Class StringUtilsTest

java.lang.Object
com.fsf.news.utils.StringUtilsTest

class StringUtilsTest extends Object
Unit tests for the StringUtils class.
  • Constructor Details

    • StringUtilsTest

      StringUtilsTest()
  • Method Details

    • testWrapDoubleQuotes

      @ParameterizedTest @MethodSource void testWrapDoubleQuotes(String input, String expected)
      Tests that a string is correctly wrapped in double quotes.
      Parameters:
      input - the input string
      expected - the expected output string
    • testWrapDoubleQuotes

      static Stream<org.junit.jupiter.params.provider.Arguments> testWrapDoubleQuotes()
      Provides test data for the testWrapDoubleQuotes method.
      Returns:
      A stream of test data
    • testRemoveHtmlTags

      @ParameterizedTest @MethodSource void testRemoveHtmlTags(String input, String expected)
      Tests that HTML tags are correctly removed from a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testRemoveHtmlTags

      static Stream<org.junit.jupiter.params.provider.Arguments> testRemoveHtmlTags()
      Provides test data for the testRemoveHtmlTags method.
      Returns:
      A stream of test data
    • testReplaceSingleQuotes

      @ParameterizedTest @MethodSource void testReplaceSingleQuotes(String input, String expected)
      Tests that single quotes are correctly replaced in a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testReplaceSingleQuotes

      static Stream<org.junit.jupiter.params.provider.Arguments> testReplaceSingleQuotes()
      Provides test data for the testReplaceSingleQuotes method.
      Returns:
      A stream of test data
    • testRemoveNonWordSymbols

      @ParameterizedTest @MethodSource void testRemoveNonWordSymbols(String input, String expected)
      Tests that non-alphanumeric characters are correctly replaced with spaces in a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testRemoveNonWordSymbols

      static Stream<org.junit.jupiter.params.provider.Arguments> testRemoveNonWordSymbols()
      Provides test data for the testRemoveNonWordSymbols method.
      Returns:
      A stream of test data
    • testCollapseConsecutiveSymbols

      @ParameterizedTest @MethodSource void testCollapseConsecutiveSymbols(String input, String expected)
      Tests that consecutive symbols are correctly collapsed in a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testCollapseConsecutiveSymbols

      static Stream<org.junit.jupiter.params.provider.Arguments> testCollapseConsecutiveSymbols()
      Provides test data for the testCollapseConsecutiveSymbols method.
      Returns:
      A stream of test data
    • testRemoveLoneSymbols

      @ParameterizedTest @MethodSource void testRemoveLoneSymbols(String input, String expected)
      Tests that lone symbols are correctly removed from a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testRemoveLoneSymbols

      static Stream<org.junit.jupiter.params.provider.Arguments> testRemoveLoneSymbols()
      Provides test data for the testRemoveLoneSymbols method.
      Returns:
      A stream of test data
    • testRemoveUnderscoreSymbols

      @ParameterizedTest @MethodSource void testRemoveUnderscoreSymbols(String input, String expected)
      Tests that underscore symbols are correctly removed from a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testRemoveUnderscoreSymbols

      static Stream<org.junit.jupiter.params.provider.Arguments> testRemoveUnderscoreSymbols()
      Provides test data for the testRemoveUnderscoreSymbols method.
      Returns:
      A stream of test data
    • testRemoveLeadingTrailingSymbols

      @ParameterizedTest @MethodSource void testRemoveLeadingTrailingSymbols(String input, String expected)
      Tests that leading and trailing symbols are correctly removed from a string.
      Parameters:
      input - the input string
      expected - the expected output string
    • testRemoveLeadingTrailingSymbols

      static Stream<org.junit.jupiter.params.provider.Arguments> testRemoveLeadingTrailingSymbols()
      Provides test data for the testRemoveLeadingTrailingSymbols method.
      Returns:
      A stream of test data
    • testSplitTokens

      @ParameterizedTest @MethodSource void testSplitTokens(String input, String[] expected)
      Tests that a string is correctly split into tokens.
      Parameters:
      input - the input string
      expected - the expected array of tokens
    • testSplitTokens

      static Stream<org.junit.jupiter.params.provider.Arguments> testSplitTokens()
      Provides test data for the testSplitTokens method.
      Returns:
      A stream of test data
    • testIsBlank

      @ParameterizedTest @MethodSource void testIsBlank(String input)
      Tests that a string is considered blank if it is null or empty.
      Parameters:
      input - the input string
    • testIsBlank

      static Stream<String> testIsBlank()
      Provides test data for the testIsBlank method.
      Returns:
      A stream of test data
    • testIsNotBlank

      @ParameterizedTest @MethodSource void testIsNotBlank(String input)
      Tests that a string is not considered blank if it is not null or empty.
      Parameters:
      input - the input string
    • testIsNotBlank

      static Stream<String> testIsNotBlank()
      Provides test data for the testIsNotBlank method.
      Returns:
      A stream of test data
    • testDefaultString

      @ParameterizedTest @MethodSource void testDefaultString(String input, String expected)
      Tests that the input is returned as is when non-null and as an empty string when null.
      Parameters:
      input - the input string to be tested
      expected - the expected result
    • testDefaultString

      static Stream<org.junit.jupiter.params.provider.Arguments> testDefaultString()
      Provides test data for the testDefaultString method.
      Returns:
      A stream of test data
    • testDefaultStringWithDefault

      @ParameterizedTest @MethodSource void testDefaultStringWithDefault(String input, String defaultStr, String expected)
      Tests that the input is returned as is when non-null and as the provided default string when null.
      Parameters:
      input - the input string
      defaultStr - the default string to use if input is null
      expected - the expected result
    • testDefaultStringWithDefault

      static Stream<org.junit.jupiter.params.provider.Arguments> testDefaultStringWithDefault()
      Provides test data for the testDefaultStringWithDefault method.
      Returns:
      a stream of test data